package Service.Impl;

import Dao.UserWechatDao;
import Model.UserWechat;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import Service.UserWechatService;

import java.util.List;

@Service
public class UserWechatServiceImpl implements UserWechatService {

    @Autowired
    private UserWechatDao userWechatDao;


    /**
     * 根据认证信息查询信息库中是否有护工
     * @param id_number
     */
    public UserWechat fingHuByIdNumber(String id_number, String name){
        System.out.println("service:根据认证信息查询信息库中是否有护工");
        UserWechat user_wechat = userWechatDao.fingHuByIdNumber(id_number, name);
        return user_wechat;
    }

    /**
     * 根据认证信息查询信息库中是否有老人
     * @param id_number
     */
    public UserWechat fingLaoByIdNumber(String id_number,String name){
        System.out.println("service:根据认证信息查询信息库中是否老人");
        UserWechat user_wechat = userWechatDao.fingLaoByIdNumber(id_number,name);
        return user_wechat;
    }

    /**
     * 护工插入微信id标识
     * @param user
     */
    public void updateHu(UserWechat user){
        System.out.println("service:插入护工微信id标识");
        userWechatDao.updateHu(user);
    }

    /**
     * 护工插入微信id标识
     * @param user
     */
    public void updateLao(UserWechat user){
        System.out.println("service:插入护工微信id标识");
        userWechatDao.updateLao(user);
    }


    /**
     * 根据OpenID查询护工信息
     * @param open_id
     * @return
     */
    public UserWechat fingHuByOpenID(String open_id){
        System.out.println("service:根据OpenID查询护工信息");
        UserWechat user_wechat = userWechatDao.fingHuByOpenID(open_id);
        return user_wechat;
    }

    /**
     * 根据OpenID查询老人信息
     * @param open_id
     * @return
     */
    public UserWechat fingLaoByOpenID(String open_id){
        System.out.println("service:根据OpenID查询老人信息");
        UserWechat user_wechat = userWechatDao.fingLaoByOpenID(open_id);
        return user_wechat;
    }

    @Override
    public List<UserWechat> findAll() {
        return userWechatDao.findAll();
    }

}
